package io.renren.modules.device.dao;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import io.renren.modules.device.entity.TDeviceThreshold;
import io.renren.modules.device.entity.vo.DeviceThresholdVO;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;

import java.util.List;

/**
 * //Add the class description
 *
 * @author lhb
 * @date 2023/6/1
 */
@Mapper
public interface TDeviceThresholdDao extends BaseMapper<TDeviceThreshold> {

    List<DeviceThresholdVO> queryDeviceThresholds();

    //    @Select("SELECT td.*, su.username as creatorName FROM t_device td LEFT JOIN sys_user su ON td.creator = su.user_id WHERE td.`name` LIKE #{key} OR td.`code` LIKE #{key}")
    List<DeviceThresholdVO> queryDeviceThresholdsByKeySearch(@Param("key") String key);

    DeviceThresholdVO getDeviceThresholdInfoById(@Param("key") String key);
    
    @Select("SELECT * FROM t_device_threshold  WHERE device_category_id=#{deviceCategoryID} AND alarm_type_id=#{alarmTypeID}")
    List<DeviceThresholdVO> getDeviceThresholdInfoByDeviceCategoryIdAndAlarmTypeId(@Param("deviceCategoryID") Long deviceCategoryID, @Param("deviceCategoryID") Long alarmTypeID);

}
